package cn.wizzer.app.crown.modules.models.enums;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 赛事分类
 */
public enum MatchTypeEnum {
    // 足球
    FOOTBALL("FT", "足球", "", ""),
    // 篮球
    BASKETBALL("BK", "篮球", "", "");
//    // 联赛
//    CHAMPION("CP", "联赛", "", "");

    private String type;

    private String cn;

    private String tw;

    private String en;

    private List<PlayWayEnum> playWays;

    MatchTypeEnum(String type, String cn, String tw, String en, PlayWayEnum... playWays) {
        this.type = type;
        this.cn = cn;
        this.tw = tw;
        this.en = en;
        this.playWays = new ArrayList<>();
        this.playWays.addAll(Arrays.stream(playWays).collect(Collectors.toList()));
    }

    public static MatchTypeEnum format(String sportType) {
        switch (sportType) {
            case "ft":
                return FOOTBALL;
            case "bk":
                return BASKETBALL;
            default:
                return null;
        }
    }

    public String getType() {
        return type;
    }


    public String getCn() {
        return cn;
    }

    public void setCn(String cn) {
        this.cn = cn;
    }

    public String getTw() {
        return tw;
    }

    public String getEn() {
        return en;
    }

    public List<PlayWayEnum> getPlayWays() {
        return playWays;
    }

    public static List toList() {
        List<Map<String, Object>> list = new ArrayList<>();
        for (MatchTypeEnum matchTypeEnum : MatchTypeEnum.values()) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", matchTypeEnum.getCn());
            map.put("val", matchTypeEnum);
            list.add(map);
        }
        return list;
    }

}

